const { contextBridge, ipcRenderer } = require("electron");

window.addEventListener("DOMContentLoaded", () => {
	contextBridge.exposeInMainWorld("ipcRenderer", {
		send: (eventKey, value) => ipcRenderer.send(eventKey, value),
		listen: (eventKey, back) => {
			ipcRenderer.on(eventKey, (e, value) => {
				back(e, value);
			});
		},
		sendSync: (eventKey, value) => {
			return ipcRenderer.sendSync(eventKey, value);
		},
	});
});
